<template>
  <div class="my-el-tabs">
    <ElTabs :model-value="modelValue" @tab-change="onChange">
      <ElTabPane v-for="item in list" :key="item.label" :name="item.name">
        <template #label>
          <div class="custom-tabs-label">
            <img v-if="item.icon" class="icon" :src="item.icon" alt="">
            <div>{{ item.label }}</div>
          </div>
        </template>
      </ElTabPane>
    </ElTabs>
  </div>
</template>
<script setup>
import { ref, defineProps, defineEmits, useAttrs } from 'vue';
import { ElTabPane, ElTabs } from 'element-plus';

const props = defineProps(["modelValue", "list"])
const emits = defineEmits(['update:modelValue']);
const onChange = (value) => {
  emits('update:modelValue', value);
}
</script>

<style lang="scss" scoped>
.my-el-tabs {
  ::v-deep .el-tabs {
    .el-tabs__header {
      margin-bottom: 24px;

      .el-tabs__item {
        line-height: 30px;
        color: #6c7786;
        font-size: 18px;
        font-weight: 700;

        &.is-active {
          color: #14181f
        }
      }

      .el-tabs__active-bar {
        width: 24px !important;
        height: 4px;
        border-radius: 2px
      }

      .el-tabs__nav-wrap:after {
        display: none;
      }
    }
  }
}

.custom-tabs-label {
  display: flex;
  align-items: center;

  .icon {
    margin-right: 4px;
    width: 24px;
    height: 24px;
  }
}
</style>
